package com.wu.family.feed;



import java.util.ArrayList;
import java.util.List;

import com.wu.family.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.Gallery;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

public class FeedPageTipsView extends LinearLayout {
	public interface OnTipsClickListener {
		void onAvatarTipsClick(View view);
		void onFeedTipsClick(View view);
	}
	OnTipsClickListener onTipsClickListener;
	public void setOnTipsClickListener(OnTipsClickListener onTipsClickListener) {
		this.onTipsClickListener = onTipsClickListener;
	}

	private static final String TAG = FeedPageTipsView.class.getSimpleName();
	private RelativeLayout rlShareFeedTips;
	private RelativeLayout rlModifyAvatarTips;
	private boolean isTipsModifyAvatar = true;
	
	public FeedPageTipsView(Context context) {
		super(context);
		init();
	}
	public FeedPageTipsView(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}
	private void init() {
		LayoutInflater.from(getContext()).inflate(R.layout.feed_page_tips, this, true);
		rlShareFeedTips = (RelativeLayout) findViewById( R.id.rlShareFeedTips );
		rlModifyAvatarTips = (RelativeLayout) findViewById( R.id.rlModifyAvatarTips );
		/*rlShareFeedTips.setVisibility(View.GONE);
		rlModifyAvatarTips.setVisibility(View.VISIBLE);*/
		setTipsModifyAvatar(true);
	}
	
	@Override
	public boolean onTouchEvent(MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_DOWN) {
			if (rlModifyAvatarTips.isShown()) {
				rlModifyAvatarTips.setVisibility(View.GONE);
				rlShareFeedTips.setVisibility(View.VISIBLE);
			}else {
				rlShareFeedTips.setVisibility(View.GONE);
				rlModifyAvatarTips.setVisibility(View.GONE);
				this.setVisibility(View.GONE);
				if (onTipsClickListener != null) {
					onTipsClickListener.onFeedTipsClick(rlShareFeedTips);
				}
			}
			/*if (rlShareFeedTips.isShown()) {
				rlShareFeedTips.setVisibility(View.GONE);
				if (isTipsModifyAvatar) {
					rlModifyAvatarTips.setVisibility(View.VISIBLE);
				}else {
					this.setVisibility(View.GONE);
				}
			}else {
				rlShareFeedTips.setVisibility(View.GONE);
				rlModifyAvatarTips.setVisibility(View.GONE);
				this.setVisibility(View.GONE);
			}*/
		}
		return true;
	}
	
	public boolean isTipsModifyAvatar() {
		return isTipsModifyAvatar;
	}
	
	public void setTipsModifyAvatar(boolean isTipsModifyAvatar) {
		this.isTipsModifyAvatar = isTipsModifyAvatar;
		rlModifyAvatarTips.setVisibility(isTipsModifyAvatar?View.VISIBLE:View.GONE);
		rlShareFeedTips.setVisibility(isTipsModifyAvatar?View.GONE:View.VISIBLE);
	}
	
	
}
